package cn.disignPattern.com.partTwo;

import java.util.HashSet;
import java.util.Observable;
import java.util.Set;

/**
 * Created by Administrator on 2021/6/22 0022.
 */
public class WeatherData2 extends Observable {

    private Set<Observer> observers;
    private float temp;
    private float humidity;
    private float pressure;



    public void measurementsChanged(){
        setChanged();
        notifyObservers();
    }

    public WeatherData2() {
        observers = new HashSet<>();
    }

    public void setWeatherData(float temp, float humidity, float pressure) {
        this.temp = temp;
        this.humidity = humidity;
        this.pressure = pressure;
        measurementsChanged();
    }

    public float getTemp() {
        return temp;
    }

    public float getHumidity() {
        return humidity;
    }

    public float getPressure() {
        return pressure;
    }
}